package com.neutech.shop.controller;

import com.neutech.shop.entity.User;
import com.neutech.shop.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Neuedu-远哥
 * @version 1.0
 * @date 2021/9/22 9:53
 */
@Controller
@RequestMapping("/back/user")
public class UserController {
    @Resource
    private UserService service;
    @RequestMapping("/list")
    public String findAll(ModelMap map){
        List<User> users = service.selectAll();
        map.addAttribute("users",users);
        return "user_list.jsp";
    }
    @RequestMapping("/updateStatus")
    public String updateStatus(Long id){
        service.updateStatus(id);
        return "redirect:list";
    }


}
